<!DOCTYPE html><html><head><title>Backbone Route Test</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><script src="../../lib/jquery.min.js"></script><script src="../../lib/underscore.js"></script><script src="../../lib/backbone.js"></script></head><body><script type="text/javascript">var test = function(a){
    return alert("test:"+a)
}
var AppRoute = Backbone.Router.extend({
    routes:{
        "post/:id": "getPost",
        "test": test(1),
        "": test(2),
        "download/*path": "downloadFile"
    }
});
var appRoute = new AppRoute;
appRoute.on('route:getPost', function (id) {
    alert("id:" + id);
});
appRoute.on("route:downloadFile",function(action){
    alert("downloadFile:" + action)
});

appRoute.navigate("test",{trigger: true});
Backbone.history.start();
</script><a type="button" href="#post/123">change hash</a></body></html>